﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminFunction.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="BitPortal.Admin.Account.Admin.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="TopBarHolder" runat="server">
    <ext:ButtonGroup ID="ButtonGroup1" runat="server" Layout="ToolbarLayout">
        <Items>
            <ext:Button runat="server" ID="btnAdd" Text="Thêm người dùng" Icon="UserAdd" Scale="Medium"
                CausesValidation="false">
                <DirectEvents>
                    <Click OnEvent="btnAdd_Click">
                        <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:ToolbarSeparator />
            <ext:Button runat="server" ID="btnEdit" Text="Sửa thông tin" Icon="UserEdit" Scale="Medium"
                CausesValidation="false">
                <DirectEvents>
                    <Click OnEvent="btnEdit_Click">
                        <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:ToolbarSeparator />
            <ext:Button runat="server" ID="btnLog" Text="Khóa" Icon="LockKey" Scale="Medium"
                CausesValidation="false">
                <DirectEvents>
                    <Click OnEvent="btnLog_Click">
                        <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:ToolbarSeparator />
            <ext:Button runat="server" ID="btnUnLog" Text="Bỏ khóa" Icon="LockOpen" Scale="Medium"
                CausesValidation="false">
                <DirectEvents>
                    <Click OnEvent="btnUnLog_Click">
                        <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:ToolbarSeparator />
            <ext:Button runat="server" ID="btnDelete" Text="Xóa người dùng" Icon="UserDelete"
                Scale="Medium">
                <DirectEvents>
                    <Click OnEvent="btnDelete_Click">
                        <EventMask ShowMask="true" Msg="Waiting..." MinDelay="500" />
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:ComboBox runat="server" ID="cbRole" Editable="false">
                <Items>
                    <ext:ListItem Text="Tất cả" Value="All" />
                    <ext:ListItem Text="TK Admin" Value="Admin" />
                    <ext:ListItem Text="TK User" Value="User" />
                    <ext:ListItem Text="TK khách hàng" Value="Customer" />
                </Items>
                <Listeners>
                    <Change Handler="document.location = '?Role='+#{cbRole}.getValue();" />
                </Listeners>
            </ext:ComboBox>
        </Items>
    </ext:ButtonGroup>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData" RemoteSort="true"
        RemotePaging="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="UserName">
                <Fields>
                    <ext:RecordField Name="UserName" Type="String" />
                    <ext:RecordField Name="Email" Type="String" />
                    <ext:RecordField Name="IsApproved" Type="Boolean" />
                    <ext:RecordField Name="IsLockedOut" Type="Boolean" />
                    <ext:RecordField Name="IsOnline" Type="Boolean" />
                    <ext:RecordField Name="CreationDate" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
                    <ext:RecordField Name="LastActivityDate" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
                    <ext:RecordField Name="LastLockoutDate" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
                    <ext:RecordField Name="LastLoginDate" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
                    <ext:RecordField Name="LastPasswordChangedDate" Type="Date" DateFormat="yyyy-MM-ddTHH:mm:ss" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="limit" Value="10" Mode="Raw" />
            <ext:Parameter Name="sort" Value="" />
            <ext:Parameter Name="dir" Value="" />
        </BaseParams>
        <SortInfo Field="UserName" Direction="ASC" />
    </ext:Store>
    <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true" Title="Danh sách người dùng"
        StoreID="Store1">
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:Column Header="Tên đăng nhập" DataIndex="UserName" />
                <ext:Column Header="Email" DataIndex="Email" Width="200" />
                <ext:Column Header="Trạng thái" DataIndex="IsLockedOut" Align="Center">
                    <Renderer Handler="return (value) ? 'Đang bị khóa':'Đang hoạt động';" />
                </ext:Column>
                <ext:Column Header="Đang online" DataIndex="IsOnline" Align="Center">
                    <Renderer Handler="return (value) ? 'Có':'Không';" />
                </ext:Column>
                <ext:DateColumn Header="Ngày tạo" DataIndex="CreationDate" Align="Center" Format="dd-MM-yyyy HH:mm:ss" />
                <ext:DateColumn Header="Hoạt động cuối" DataIndex="LastActivityDate" Align="Center"
                    Format="dd-MM-yyyy HH:mm:ss" />
                <ext:DateColumn Header="Lần đăng nhập cuối" DataIndex="LastLoginDate" Align="Center"
                    Format="dd-MM-yyyy HH:mm:ss" />
                <ext:DateColumn Header="Lần đăng xuất cuối" DataIndex="LastLockoutDate" Align="Center"
                    Format="dd-MM-yyyy HH:mm:ss" />
                <ext:DateColumn Header="Lần đổi mật khẩu cuối" DataIndex="LastPasswordChangedDate"
                    Align="Center" Format="dd-MM-yyyy HH:mm:ss" />
                <%-- <ext:ImageCommandColumn Header="Command" Align="Center">
                    <Commands>
                        <ext:ImageCommand CommandName="MyCommand" Icon="TableEdit" ToolTip-Text="Sửa thông tin">
                        </ext:ImageCommand>
                    </Commands>
                </ext:ImageCommandColumn>--%>
            </Columns>
        </ColumnModel>
        <%-- <Listeners>
            <Command Handler="Ext.net.DirectMethods.DoSomething(record.data.UserName);" />
        </Listeners>--%>
        <SelectionModel>
            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
        </SelectionModel>
        <LoadMask ShowMask="true" />
        <Plugins>
            <ext:GridFilters runat="server" ID="GridFilters1">
                <Filters>
                    <ext:StringFilter DataIndex="UserName" />
                    <ext:StringFilter DataIndex="Email" />
                    <ext:BooleanFilter DataIndex="IsLockedOut" />
                    <ext:BooleanFilter DataIndex="IsOnline" />
                </Filters>
            </ext:GridFilters>
        </Plugins>
        <BottomBar>
            <ext:PagingToolbar ID="PagingToolbar1" runat="server" PageSize="20" />
        </BottomBar>
    </ext:GridPanel>
    <ext:Window ID="Window1" runat="server" Collapsible="true" Icon="ApplicationEdit"
        Title="Title" Width="750" Height="500" AutoScroll="true" Hidden="true">
        <Content>
            <uc:AdminAddEdit runat="server" ID="AdminAddEdit1" />
        </Content>
    </ext:Window>
</asp:Content>
